#ifndef INFO_H
#define INFO_H
#include<QString>
#include<QStringList>
#include<QDebug>

struct Info
{
    virtual QStringList getHorizontalHeaderLabels()=0;
    virtual QStringList getcolname()=0;
    virtual QString getTablename()=0;
    virtual int get_ID_col()=0;
    virtual int get_key_col()=0;
    virtual Info *getInstance(int i)=0;
    virtual QString& find(int i,int j)=0;

    QString getcolname(int i){return getcolname().at(i);}
    int colsize(){return getcolname().size();}
    Info(){}
};


struct InfoSet{
    Info* info;
    int size;
    InfoSet(Info* type,int s)
        :size(s),info(type->getInstance(s)),HorizontalHeaderLabels(type->getHorizontalHeaderLabels()),colsize(type->colsize()){}
    QString& item(int i,int j){return info->find(i,j);}
    QStringList HorizontalHeaderLabels;
    int colsize;
};


//学生基本信息
struct StuInfo:Info{
    QString stu_address;
    QString stu_phonenum;
    QString stu_id;
    QString stu_name;
    QString stu_username;
    QString stu_password;
    QString*info[6];
    StuInfo():info({&stu_address,&stu_phonenum,&stu_id,&stu_name,&stu_username,&stu_password}){}
    QStringList getHorizontalHeaderLabels(){return {"学生地址","学生电话号码","学生编号","学生姓名","学生账号","学生密码"};}
    QStringList getcolname(){return{"stu_address","stu_phonenum","stu_id","stu_name","stu_username","stu_password"};}
    QString getTablename(){return"student";}
    int get_ID_col(){return 2;}
    int get_key_col(){return 2;}
    Info *getInstance(int i){return new StuInfo[i]();}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};
struct StuToShow:StuInfo{
    QStringList getHorizontalHeaderLabels(){return {"学生地址","学生电话号码","学生编号","学生姓名"};}
    QStringList getcolname(){return{"stu_address","stu_phonenum","stu_id","stu_name"};}
    Info *getInstance(int i){return new StuToShow[i]();}

};

//教师基本信息
struct TechInfo:Info{
    QString tech_id;
    QString tech_name;
    QString tech_school;//教学学校
    QString tech_address;//老师地址
    QString tech_phone;//老师电话号码
    QString tech_username;
    QString tech_password;
    QString*info[7];
    TechInfo():info({&tech_id,&tech_name,&tech_school,&tech_address,&tech_phone,&tech_username,&tech_password}){}
    QStringList getHorizontalHeaderLabels(){return {"教师编号","教师姓名","教学学校","教师地址","教师电话号码","教师账号","教师密码"};}
    QStringList getcolname(){return {"tech_id","tech_school","tech_name","tech_address","tech_phonenum","tech_username","tech_password"};}
    QString getTablename(){return"teacher";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 0;}
    Info *getInstance(int i){return new TechInfo[i]();}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};
struct TechToShow:TechInfo{
    QStringList getHorizontalHeaderLabels(){return {"教师编号","教师姓名","教学学校","教师地址","教师电话号码"};}
    QStringList getcolname(){return {"tech_id","tech_school","tech_name","tech_address","tech_phonenum"};}
    Info *getInstance(int i){return new TechToShow[i]();}
};


//学生学习经历
struct StuExp:Info{
    QString stu_id;
    QString primary_school;
    QString middle_school;
    QString high_school;
    QString university;
    QString*info[5];
    StuExp():info({&stu_id,&primary_school,&middle_school,&high_school,&university}){}
    QStringList getHorizontalHeaderLabels(){return {"学生编号","小学","初中","高中","大学"};}
    QStringList getcolname(){return{"stu_id","primary_school","middle_school","high_school","university"};}
    QString getTablename(){return"stu_exp";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 0;}
    Info *getInstance(int i){return new StuExp[i]();}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};

//论文信息
struct PaperInfo:Info{
    QString tech_id;
    QString paper_id;
    QString paper_name;
    QString paper_info;
    QString*info[4];
    PaperInfo():info({&tech_id,&paper_id,&paper_name,&paper_info}){}
    QStringList getHorizontalHeaderLabels(){return {"教师编号","论文编号","论文标题","论文摘要"};}
    QStringList getcolname(){return{"tech_id","paper_id","paper_name","paper_info"};}
    QString getTablename(){return"paper";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 1;}
    Info *getInstance(int i){return new PaperInfo[i];}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};


//科研成果
struct Sci_Result:Info{
    QString tch_id;
    QString sci_result_id;
    QString sci_result_name;
    QString*info[3];
    Sci_Result():info({&tch_id,&sci_result_id,&sci_result_name}){}
    QStringList getHorizontalHeaderLabels(){return {"教师编号","科研成果编号","科研成果标题"};}
    QStringList getcolname(){return{"tech_id","sci_result_id","sci_reslut_name"};}
    QString getTablename(){return"sci_result";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 1;}
    Info *getInstance(int i){return new Sci_Result[i];}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};

//工作经历
struct Work_exp:Info{
    QString tch_id;
    QString tch_work_id;
    QString start_time;
    QString end_time;
    QString work_place;
    QString*info[5];
    Work_exp():info({&tch_id,&tch_work_id,&start_time,&end_time,&work_place}){}
    QStringList getHorizontalHeaderLabels(){return {"教师编号","工作编号","开始时间","结束时间","工作地点"};}
    QStringList getcolname(){return{"tech_id","work_id","start_time","end_time","work_place"};}
    QString getTablename(){return"work_exp";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 1;}
    Info *getInstance(int i){return new Work_exp[i];}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};

//成长记录信息
struct Develop:Info{
    QString tch_id;
    QString now_condition;
    QString grow_up;
    QString dev_method;
    QString*info[4];
    Develop():info({&tch_id,&now_condition,&grow_up,&dev_method}){}
    QStringList getHorizontalHeaderLabels(){return {"教师编号","教学现状","成长目标","提升方法"};}
    QStringList getcolname(){return{"tech_id","now_condition_ana","grow_up_des","dev_method"};}
    QString getTablename(){return"Dev_ana";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 0;}
    Info *getInstance(int i){return new Develop[i];}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};

//招聘信息
struct Recruit:Info{
    QString recruit_id;
    QString pos;
    QString salary;
    QString*info[3];
    Recruit():info({&recruit_id,&pos,&salary}){}
    QStringList getHorizontalHeaderLabels(){return {"招聘信息编号","招聘岗位","预期薪资"};}
    QStringList getcolname(){return{"recruit_id","pos","salary"};}
    QString getTablename(){return"recruit";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 0;}
    Info *getInstance(int i){return new Recruit[i];}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};

//应聘信息
struct Appc:Info{
    QString app_id;
    QString tech_id;
    QString pos;
    QString salary;
    QString*info[4];
    Appc():info({&app_id,&tech_id,&pos,&salary}){}
    QStringList getHorizontalHeaderLabels(){return {"应聘信息编号","教师编号","应聘岗位","预期薪资"};}
    QStringList getcolname(){return{"app_id","tech_id","pos","salary"};}
    QString getTablename(){return"application";}
    int get_ID_col(){return 1;}
    int get_key_col(){return 0;}
    Info *getInstance(int i){return new Appc[i];}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};

//实习管理
struct Intern:Info{
    QString tech_id;
    QString intern_id;
    QString intern_name;
    QString*info[3];
    Intern():info({&tech_id,&intern_id,&intern_name}){}
    QStringList getHorizontalHeaderLabels(){return {"教师编号","实习编号","实习岗位"};}
    QStringList getcolname(){return{"tech_id","intern_id","intern_name"};}
    QString getTablename(){return"intern";}
    int get_ID_col(){return 0;}
    int get_key_col(){return 1;}
    Info *getInstance(int i){return new Intern[i];}
    QString&find(int i,int j){return *((this+i)->info[j]);}
};

#endif // INFO_H
